import { ajaxService } from '@/utils/request';
import {
  GetPersonnelinformation,
  addPersonnel,
  Getsingleperson,
  Alterpersonnel,
  DeletingPersonnel,
} from '../../type';

const env = import.meta.env;
let baseURL = env.VITE_STAFF_URL;

/* 人员信息   */

// 获取人员信息列表
export function GetPersonnelinformation(params: any) {
  return ajaxService({
    url: '/staff/search',
    params,
    method: 'get',
    baseURL,
  });
}

// 添加人员信息
export function addPersonnel(data: addPersonnel) {
  return ajaxService({
    url: '/staff/add',
    data,
    method: 'post',
    baseURL,
  });
}

// 修改人员信息
export function alterPersonnel(data: Alterpersonnel) {
  return ajaxService({
    url: '/staff/mod',
    data,
    method: 'put',
    baseURL,
  });
}

// 获取单个人员信息
export function Getsingleperson(params: Getsingleperson) {
  return ajaxService({
    url: '/staff/get',
    params,
    method: 'get',
    baseURL,
  });
}

// 删除个人信息
export function DeletingPersonnel(params: DeletingPersonnel) {
  return ajaxService({
    url: '/staff/del',
    params,
    method: 'delete',
    baseURL,
  });
}

//  获取组织架构

// 获取角色信息
export function GetRoleInformation() {
  return ajaxService({
    url: '/staff/role/getAll',
    method: 'get',
    baseURL,
  });
}

// 离职在职状态修改
export function putStaffModStatus(data: any) {
  return ajaxService({
    url: '/staff/mod/status',
    method: 'put',
    baseURL,
    data,
  });
}
